package com.visionblue.business.ship.page.collection.record;

import android.app.Activity;

import com.sun.jna.Pointer;
import com.visionblue.business.ship.model.bean.local.PrintInfo;

import java.lang.reflect.Method;

/**
 * des:
 * author: ysj
 * date: 2021/3/23
 */
public class UsbUtil {
    public  void print(Activity activity, String functionName, Pointer h, PrintInfo printInfo){

        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    TestFunction fun = new TestFunction();
                    fun.setPrintInfo(printInfo,activity);
                    fun.ctx = activity;
                    Method m = TestFunction.class.getDeclaredMethod(functionName, Pointer.class);
                    m.invoke(fun, h);
                } catch (Throwable tr) {
                    tr.printStackTrace();
                }
                activity.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {

                    }
                });
            }
        }).start();
    }
}
